﻿//config
var type = "post";
var id;
var name;
var headImgUrl;
//sinaLoad
WB.core.load(['connect', 'client'], function () {
    var cfg = {
        key: '1117408883',
        xdpath: 'http://www.baomihua.com/ui/xd.html'
    };
    WB.connect.init(cfg);
    WB.client.init(cfg);
    GetCurrentLoginID();
});
//与新浪连接按钮
$("#sinaLogin").click(function () {
    LoginIn();
});
//LoginIn
function LoginIn() {
    WB.connect.login(function () {
        GetCurrentLoginID();
    });
}
//LoginOut
function LoginOut() {
    WB.connect.logout(function () {
        alert("退出成功！");
    });
}

//获取当前登录用户的新浪ID
function GetCurrentLoginID() {
    var method = "/account/verify_credentials.json";
    var args = {};
    WB.client.parseCMD(method, function (result, status) {
        if (status == true && result.id != undefined && result.id != "") {
            name = result.screen_name;
            headImgUrl = result.profile_image_url;
            id = result.id;
            ProcessLoginId(result.id);
        }
    }, args, { 'method': type });
}
//